package com.example.service.impl;

import com.example.entity.User;
import com.example.mapper.UserMapper;
import com.example.service.UserService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User getUserWithRoles(String loginname) {
        return userMapper.selectUserWithRoles(loginname);
    }

    @Override
    public Page<User> getUsersWithRolesAndMenus(String loginname, String email, Integer status, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return userMapper.selectUsersWithRolesAndMenus(loginname, email, status);
    }
}